﻿using OF.Component.BLL;
using OF.Component.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;

namespace Basic.Api.Controllers
{
    /// <summary>
    /// 
    /// </summary>
    public class CityController: ApiController
    {


        /// <summary>
        /// 获取所有城市信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public ResultData<List<BaseLocation_AllInfo>> GetCityAll()
        {
            ResultData<List<BaseLocation_AllInfo>> rData = new ResultData<List<BaseLocation_AllInfo>>();
            IList<BaseLocation_AllInfo> list = BaseLocation_AllOperate.QueryList(a => a.locationId > 0);
            rData.data = list.ToList();
            return rData;
        }

        /// <summary>
        /// 获取城市信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public ResultData<List<BaseLocation_AllInfo>> GetCityInfo(int locationId)
        {
            ResultData<List<BaseLocation_AllInfo>> rData = new ResultData<List<BaseLocation_AllInfo>>();
            IList<BaseLocation_AllInfo> list = BaseLocation_AllOperate.QueryList(a => a.locationId ==locationId);
            rData.data = list.ToList();
            return rData;
        }
    }
}